package com.apigateway.controller;

import com.apigateway.init.ServiceInit;
import com.apigateway.mapper.ApiServiceCallMapper;
import com.apigateway.mapper.ApiServiceMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.websocket.server.PathParam;
import java.util.Map;

/**
 * Created by 小泽玛丽罗 on 2017/2/28.
 */
@Controller
public class ServiceController {
    //http://blog.csdn.net/qiutongyeluo/article/details/51918888

    @Autowired
    private ApiServiceCallMapper apiServiceCallMapper;

    @Autowired
    private ApiServiceMapper apiServiceMapper;

    @RequestMapping("/service")
    public String service(Map<String,Object> model
            , @RequestParam(value = "serviceType"
            , defaultValue = "atom") String serviceType ){
        if(serviceType.equals("atom")){
            model.put("services",ServiceInit.getAtomApiServices());
            model.put("serviceType","atom");
        }else{
            model.put("services",ServiceInit.getCombinationApiServices());
            model.put("serviceType","combination");
        }
        model.put("gqb","顾乾斌");
        return "web";
    }

    public String atomService(Map<String,Object> model){

        return "atomService";
    }
}
